﻿using System;
using System.Collections.Generic;

namespace IceDog.DNF.Program.Poker.Core
{
    /// <summary>
    /// 卡片列表对象
    /// </summary>
    public class CardList:List<Card>,ICloneable
    {
        /// <summary>创建作为当前实例副本的新对象。</summary>
        /// <returns>作为此实例副本的新对象。</returns>
        public object Clone()
        {
            var list = new CardList();
            foreach (Card card in this)
            {
                list.Add(card.Clone() as Card);
            }
            return list;
        }

        /// <summary>
        /// 把当前的cardList 复制到另一个cardList
        /// </summary>
        /// <param name="cardList">目标对象</param>
        public void CopyTo(CardList cardList)
        {
            for (int i = 0; i < Count; i++)
            {
                cardList[i] = this[i];
            }
        }
    }
}
